package transform

import "demo/infra/common/constant"

// TransformContext 转换上下文
type TransformContext struct {
	CompressCode    string
	Headers         map[string]string
	TransformEvent  *TransformEvent
	TransformStatus constant.TransformStatus
}

// SetTransformStatus 设置转换状态并同步到事件
func (c *TransformContext) SetTransformStatus(status constant.TransformStatus) {
	c.TransformStatus = status
	if c.TransformEvent != nil {
		c.TransformEvent.TransformStatusValue = status.Value()
	}
}

// TransformEvent 转换事件记录
type TransformEvent struct {
	ClientIp             string
	CompressCode         string
	UserAgent            string
	CookieValue          string
	Timestamp            int64
	ShortUrlString       string
	LongUrlString        string
	TransformStatusValue int16
}
